package com.teacher.pc.controller;


import com.teacher.common.CommonResult;
import com.teacher.pojo.dto.courseconteststask.CourseContestsTaskAddDto;
import com.teacher.pojo.dto.courseconteststask.CourseContestsTaskUpdateDto;
import com.teacher.pojo.dto.innovativeundertakingtask.InnovativeUndertakingTaskAddDto;
import com.teacher.pojo.dto.innovativeundertakingtask.InnovativeUndertakingTaskUpdateDto;
import com.teacher.pojo.vo.courseconteststask.CourseContestsTaskGetVo;
import com.teacher.pojo.vo.innovativeundertakingtask.InnovativeUndertakingTaskGetVo;
import com.teacher.service.ICourseContestsTaskService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 学科竞赛 前端控制器
 * </p>
 *
 * @author zfm
 * @since 2021-08-13
 */
@RestController
@RequestMapping("/pc/course-contests-task")
public class CourseContestsTaskController {

    @Autowired
    private ICourseContestsTaskService iCourseContestsTaskService;

    /**
     * 发起学科竞赛审批流程
     *
     * @param dto
     * @return
     */
    @PostMapping
    @ApiOperation("发起学科竞赛审批流程 10->国家一等 20->国家二等 30->国家三等 40->省级一等 50->省级二等 60->省级三等 70->市、校级一等 80->市、校级二等 90->市、校级三等 100->院级一等 110->院级二等 120->院级三等")
    public CommonResult<String> add(@RequestBody CourseContestsTaskAddDto dto) {
        return iCourseContestsTaskService.add(dto);
    }

    /**
     * 更新流程
     *
     * @param dto
     * @return
     */
    @PutMapping
    @ApiOperation("更新流程")
    public CommonResult<String> update(@RequestBody CourseContestsTaskUpdateDto dto) {
        return iCourseContestsTaskService.updateInfo(dto);
    }

    /**
     * 获取详情
     *
     * @return
     */
    @GetMapping("/{flowId}")
    @ApiOperation("获取详情")
    public CommonResult<CourseContestsTaskGetVo> getDetails(@PathVariable("flowId") Long id) {
        return iCourseContestsTaskService.getDetails(id);
    }

}

